package com.lh.ai.server.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * swagger文档：http://localhost:8080/swagger-ui.html#/rPlus214572406723545276042638121153
 */
@RestController
@RequestMapping(path = "/hello")
@Slf4j
public class HelloController {

    @GetMapping("/hello")
    public String test(@RequestParam String jobId) {
        return "u success join!";
    }

    /*@PostMapping("/calcCompare")
    @ApiOperation(value = "计算结果比对服务", notes = "用于分别计算新发布和未发布服务器执行结果并比对", response = ResponseModel.class, httpMethod = "POST")
    @CatLog(name="queryInfos")
    public ResponseModel<Object> queryInfos(@RequestBody @Validated RplusCalcRequest params) {
        return rplusCalcCompareService.queryAndCompletable(params);
    }

    @GetMapping("/download")
    @ApiOperation(value = "下载计算对比结果", notes = "下载计算对比结果", response = ResponseModel.class, httpMethod = "GET")
    @CatLog(name="download")
    public void download(@RequestParam @ApiParam(required = true, value = "任务ID") String jobId) {
        rplusCalcCompareService.downloadCompareResult(jobId);
    }

    @GetMapping("/log")
    @ApiOperation(value = "查看任务运行日志", notes = "查看任务运行日志", response = ResponseModel.class, httpMethod = "GET")
    @CatLog(name="log")
    public ResponseModel<Object> log(@RequestParam @ApiParam(required = true, value = "任务ID") String jobId) {
        return rplusCalcCompareService.loadProcessLog(jobId);
    }

    @PostMapping("/job/paging")
    @ApiOperation(value = "计算结果分页列表", notes = "展示全部计算结果信息", response = ResponseModel.class, httpMethod = "POST")
    @CatLog(name="jobPaging")
    public ResponseModel<Object> jobPaging(@RequestBody @Validated RplusCalcRequest.PageVo params) {
        return rplusCalcCompareService.jobPaging(params);
    }

    @DeleteMapping("/job/delete")
    @ApiOperation(value = "删除任务", notes = "删除任务", response = ResponseModel.class, httpMethod = "DELETE")
    public ResponseModel<Object> delete(@RequestParam(value="jobIds") @ApiParam(value = "jobIds", required = true) @NotEmpty(message="请输入任务ID数组，逗号分隔") String jobIds) {
        return rplusCalcCompareService.delete(jobIds);
    }*/

}